package com.sphd.restaurantsystem.presenter;


import com.android.volley.VolleyError;
import com.sphd.restaurantsystem.info.RestaurantInfo;
import com.sphd.restaurantsystem.model.FoodtogoSettingModelImpl;
import com.sphd.restaurantsystem.view.FoodtogoSettingView;

/**
* Created by Hu on 2016/12/14
*/

public class FoodtogoSettingPresenterImpl implements FoodtogoSettingPresenter {
    FoodtogoSettingModelImpl foodtogoSettingModel;
    FoodtogoSettingView foodtogoSettingView;

    public FoodtogoSettingPresenterImpl(FoodtogoSettingView foodtogoSettingView) {
        this.foodtogoSettingView = foodtogoSettingView;
        foodtogoSettingModel=new FoodtogoSettingModelImpl();
    }

    @Override
    public void addData(String url) {
        foodtogoSettingView.showLoading();
            foodtogoSettingModel.sendUrl(url,this);
    }

    @Override
    public void sendError(VolleyError error) {
        foodtogoSettingView.dissLoading();
    }

    @Override
    public void getResInfo(String url) {
        foodtogoSettingView.showLoading();
        foodtogoSettingModel.getMsgUrl(url,this);
    }

    @Override
    public void recMsg(RestaurantInfo restaurantInfo) {
        foodtogoSettingView.recMsg(restaurantInfo);
        foodtogoSettingView.dissLoading();
    }

    @Override
    public void recRes(int res) {
            foodtogoSettingView.recRes(res);
        foodtogoSettingView.dissLoading();
    }
}